package com.itheima.dao;

import com.itheima.dto.PageResult;
import com.itheima.dto.Result;
import com.itheima.pojo.CheckItem;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;


import java.util.List;

@Mapper
@Component
public interface CheckitemDao {
    // 分页查询结果以及总记录数
    public List<CheckItem> findPages(@Param("page") Integer page , @Param("pageSize") Integer pageSize , @Param("queryString") String queryString);
    public Long findPagesCound(@Param("page") Integer page , @Param("pageSize") Integer pageSize , @Param("queryString") String queryString);
    //新增
    @Insert("insert into t_checkitem values(null,#{code},#{name},#{sex},#{age},#{price},#{type},#{remark},#{attention})")
    void saveCheckitem(CheckItem checkItem);

    //根据id查询检查项
    @Select("select * from t_checkitem where id = #{id}")
    CheckItem selectByid(Integer id);
    //编辑检查项
    @Update("update  t_checkitem set code = #{code},name = #{name},sex = #{sex},age = #{age},price = #{price},type = #{type},remark = #{remark},attention = #{attention} where id = #{id}")
    void updateCheckitem(CheckItem checkItem);
    //查询所有检查项数据【给下面检查组功能使用的】
    @Select("select * from t_checkitem ")
    List<CheckItem> selectAll();
    //删除
    @Delete("delete from t_checkitem where id = #{id}")
    void deleteById(Integer id);
}
